import React from 'react'
import Header from './layous/Header'
import Main from './layous/Main'
import Footer from './layous/bottom'
class App extends React.Component {
    constructor(){
        super()
        this.state = {
            active:0
        }
       
        //头部数据
        this.nav = [
            '首页','新闻'
        ]
    }

    //切换\激活的也免得标记active
    switchActive=(index)=>{
        this.setState((state)=>{
            return {
                active:index
            }
        })
    }

    render() {
        return <>
            {/* 头部 */}
            <Header active={this.state.active} nav={this.nav} switchActive={this.switchActive}></Header>
            {/* 中间区 */}
            <Main active={this.state.active}></Main>
            {/* 底部 */}
            <Footer></Footer>
        </>
    }
}

export default App